<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="suggestioninfo" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{suggestioninfoHome.managed ? 'Edit' : 'Add'} Suggestioninfo</f:facet>



            <s:decorate id="createDateField" template="layout/edit.xhtml">
                <ui:define name="label">Create date</ui:define>
                <rich:calendar id="createDate"
                       required="true"
                          value="#{suggestioninfoHome.instance.createDate}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>


            <s:decorate id="infoMsgField" template="layout/edit.xhtml">
                <ui:define name="label">Info msg</ui:define>
                <h:inputTextarea id="infoMsg"
                               cols="80"
                               rows="5"
                              value="#{suggestioninfoHome.instance.infoMsg}"/>
            </s:decorate>


            <s:decorate id="qualityField" template="layout/edit.xhtml">
                <ui:define name="label">Quality</ui:define>
                <h:inputText id="quality"
                           size="45"
                      maxlength="45"
                          value="#{suggestioninfoHome.instance.quality}">
                    <a:support event="onblur" reRender="qualityField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="lastCommentDateField" template="layout/edit.xhtml">
                <ui:define name="label">Last comment date</ui:define>
                <rich:calendar id="lastCommentDate"
                          value="#{suggestioninfoHome.instance.lastCommentDate}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>



            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{suggestioninfoHome.persist}"
                       disabled="#{!suggestioninfoHome.wired}"
                       rendered="#{!suggestioninfoHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{suggestioninfoHome.update}"
                       rendered="#{suggestioninfoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{suggestioninfoHome.remove}"
                      immediate="true"
                       rendered="#{suggestioninfoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Suggestioninfo.xhtml"
                rendered="#{suggestioninfoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty suggestioninfoFrom ? 'SuggestioninfoList' : suggestioninfoFrom}.xhtml"
                rendered="#{!suggestioninfoHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Commentonsuggestions">
        <h:form styleClass="association" id="commentonsuggestionsChildren">

            <h:outputText value="There are no commentonsuggestions associated with this suggestioninfo."
                       rendered="#{empty suggestioninfoHome.commentonsuggestions}"/>

            <rich:dataTable value="#{suggestioninfoHome.commentonsuggestions}"
                           var="_commentonsuggestion"
                      rendered="#{not empty suggestioninfoHome.commentonsuggestions}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="commentonsuggestionsTable">
                <rich:column sortBy="#{_commentonsuggestion.idCommentOnSuggestion}">
                    <f:facet name="header">Id comment on suggestion</f:facet>
                    <h:outputText value="#{_commentonsuggestion.idCommentOnSuggestion}"/>
                </rich:column>
                <rich:column sortBy="#{_commentonsuggestion.msg}">
                    <f:facet name="header">Msg</f:facet>
                    <h:outputText value="#{_commentonsuggestion.msg}"/>
                </rich:column>
                <rich:column sortBy="#{_commentonsuggestion.createDate}">
                    <f:facet name="header">Create date</f:facet>
                    <h:outputText value="#{_commentonsuggestion.createDate}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{suggestioninfoHome.managed}" id="commentonsuggestions">
        <div class="actionButtons">
            <s:button id="addcommentonsuggestion"
                   value="Add commentonsuggestion"
                    view="/CommentonsuggestionEdit.xhtml"
             propagation="none">
                 <f:param name="suggestioninfoIdSuggestionInfo"
                         value="#{suggestioninfoHome.instance.idSuggestionInfo}"/>
                 <f:param name="commentonsuggestionFrom" value="Suggestioninfo"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Suggestions">
        <h:form styleClass="association" id="suggestionsChildren">

            <h:outputText value="There are no suggestions associated with this suggestioninfo."
                       rendered="#{empty suggestioninfoHome.suggestions}"/>

            <rich:dataTable value="#{suggestioninfoHome.suggestions}"
                           var="_suggestion"
                      rendered="#{not empty suggestioninfoHome.suggestions}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="suggestionsTable">
                <rich:column sortBy="#{_suggestion.idSuggestion}">
                    <f:facet name="header">Id suggestion</f:facet>
                    <h:outputText value="#{_suggestion.idSuggestion}"/>
                </rich:column>
                <rich:column sortBy="#{_suggestion.createDate}">
                    <f:facet name="header">Create date</f:facet>
                    <h:outputText value="#{_suggestion.createDate}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_suggestion.rejectDate}">
                    <f:facet name="header">Reject date</f:facet>
                    <h:outputText value="#{_suggestion.rejectDate}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_suggestion.seenDate}">
                    <f:facet name="header">Seen date</f:facet>
                    <h:outputText value="#{_suggestion.seenDate}">
                        <s:convertDateTime type="both" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{suggestioninfoHome.managed}" id="suggestions">
        <div class="actionButtons">
            <s:button id="addsuggestion"
                   value="Add suggestion"
                    view="/SuggestionEdit.xhtml"
             propagation="none">
                 <f:param name="suggestioninfoIdSuggestionInfo"
                         value="#{suggestioninfoHome.instance.idSuggestionInfo}"/>
                 <f:param name="suggestionFrom" value="Suggestioninfo"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
